<?php
	/**
	 * This is a MetaControl class, providing a QForm or QPanel access to event handlers
	 * and QControls to perform the Create, Edit, and Delete functionality
	 * of the TableProjectWon class.  This code-generated class
	 * contains all the basic elements to help a QPanel or QForm display an HTML form that can
	 * manipulate a single TableProjectWon object.
	 *
	 * To take advantage of some (or all) of these control objects, you
	 * must create a new QForm or QPanel which instantiates a TableProjectWonMetaControl
	 * class.
	 *
	 * Any and all changes to this file will be overwritten with any subsequent
	 * code re-generation.
	 * 
	 * @package My Application
	 * @subpackage MetaControls
	 * property-read TableProjectWon $TableProjectWon the actual TableProjectWon data class being edited
	 * property QLabel $IdControl
	 * property-read QLabel $IdLabel
	 * property QListBox $ProjectIdControl
	 * property-read QLabel $ProjectIdLabel
	 * property QListBox $BuyerIdControl
	 * property-read QLabel $BuyerIdLabel
	 * property QListBox $ProviderIdControl
	 * property-read QLabel $ProviderIdLabel
	 * property QIntegerTextBox $BidControl
	 * property-read QLabel $BidLabel
	 * property QIntegerTextBox $DayControl
	 * property-read QLabel $DayLabel
	 * property QDateTimePicker $WonDateControl
	 * property-read QLabel $WonDateLabel
	 * property QDateTimePicker $RetractDateControl
	 * property-read QLabel $RetractDateLabel
	 * property QDateTimePicker $AcceptDateControl
	 * property-read QLabel $AcceptDateLabel
	 * property QIntegerTextBox $StatusControl
	 * property-read QLabel $StatusLabel
	 * property-read string $TitleVerb a verb indicating whether or not this is being edited or created
	 * property-read boolean $EditMode a boolean indicating whether or not this is being edited or created
	 */

	class TableProjectWonMetaControlGen extends QBaseClass {
		// General Variables
		protected $objTableProjectWon;
		protected $objParentObject;
		protected $strTitleVerb;
		protected $blnEditMode;

		// Controls that allow the editing of TableProjectWon's individual data fields
		protected $lblId;
		protected $lstProject;
		protected $lstBuyer;
		protected $lstProvider;
		protected $txtBid;
		protected $txtDay;
		protected $calWonDate;
		protected $calRetractDate;
		protected $calAcceptDate;
		protected $txtStatus;

		// Controls that allow the viewing of TableProjectWon's individual data fields
		protected $lblProjectId;
		protected $lblBuyerId;
		protected $lblProviderId;
		protected $lblBid;
		protected $lblDay;
		protected $lblWonDate;
		protected $lblRetractDate;
		protected $lblAcceptDate;
		protected $lblStatus;

		// QListBox Controls (if applicable) to edit Unique ReverseReferences and ManyToMany References

		// QLabel Controls (if applicable) to view Unique ReverseReferences and ManyToMany References


		/**
		 * Main constructor.  Constructor OR static create methods are designed to be called in either
		 * a parent QPanel or the main QForm when wanting to create a
		 * TableProjectWonMetaControl to edit a single TableProjectWon object within the
		 * QPanel or QForm.
		 *
		 * This constructor takes in a single TableProjectWon object, while any of the static
		 * create methods below can be used to construct based off of individual PK ID(s).
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this TableProjectWonMetaControl
		 * @param TableProjectWon $objTableProjectWon new or existing TableProjectWon object
		 */
		 public function __construct($objParentObject, TableProjectWon $objTableProjectWon) {
			// Setup Parent Object (e.g. QForm or QPanel which will be using this TableProjectWonMetaControl)
			$this->objParentObject = $objParentObject;

			// Setup linked TableProjectWon object
			$this->objTableProjectWon = $objTableProjectWon;

			// Figure out if we're Editing or Creating New
			if ($this->objTableProjectWon->__Restored) {
				$this->strTitleVerb = QApplication::Translate('Edit');
				$this->blnEditMode = true;
			} else {
				$this->strTitleVerb = QApplication::Translate('Create');
				$this->blnEditMode = false;
			}
		 }

		/**
		 * Static Helper Method to Create using PK arguments
		 * You must pass in the PK arguments on an object to load, or leave it blank to create a new one.
		 * If you want to load via QueryString or PathInfo, use the CreateFromQueryString or CreateFromPathInfo
		 * static helper methods.  Finally, specify a CreateType to define whether or not we are only allowed to 
		 * edit, or if we are also allowed to create a new one, etc.
		 * 
		 * @param mixed $objParentObject QForm or QPanel which will be using this TableProjectWonMetaControl
		 * @param integer $intId primary key value
		 * @param QMetaControlCreateType $intCreateType rules governing TableProjectWon object creation - defaults to CreateOrEdit
 		 * @return TableProjectWonMetaControl
		 */
		public static function Create($objParentObject, $intId = null, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			// Attempt to Load from PK Arguments
			if (strlen($intId)) {
				$objTableProjectWon = TableProjectWon::Load($intId);

				// TableProjectWon was found -- return it!
				if ($objTableProjectWon)
					return new TableProjectWonMetaControl($objParentObject, $objTableProjectWon);

				// If CreateOnRecordNotFound not specified, throw an exception
				else if ($intCreateType != QMetaControlCreateType::CreateOnRecordNotFound)
					throw new QCallerException('Could not find a TableProjectWon object with PK arguments: ' . $intId);

			// If EditOnly is specified, throw an exception
			} else if ($intCreateType == QMetaControlCreateType::EditOnly)
				throw new QCallerException('No PK arguments specified');

			// If we are here, then we need to create a new record
			return new TableProjectWonMetaControl($objParentObject, new TableProjectWon());
		}

		/**
		 * Static Helper Method to Create using PathInfo arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this TableProjectWonMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing TableProjectWon object creation - defaults to CreateOrEdit
		 * @return TableProjectWonMetaControl
		 */
		public static function CreateFromPathInfo($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::PathInfo(0);
			return TableProjectWonMetaControl::Create($objParentObject, $intId, $intCreateType);
		}

		/**
		 * Static Helper Method to Create using QueryString arguments
		 *
		 * @param mixed $objParentObject QForm or QPanel which will be using this TableProjectWonMetaControl
		 * @param QMetaControlCreateType $intCreateType rules governing TableProjectWon object creation - defaults to CreateOrEdit
		 * @return TableProjectWonMetaControl
		 */
		public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) {
			$intId = QApplication::QueryString('intId');
			return TableProjectWonMetaControl::Create($objParentObject, $intId, $intCreateType);
		}



		///////////////////////////////////////////////
		// PUBLIC CREATE and REFRESH METHODS
		///////////////////////////////////////////////

		/**
		 * Create and setup QLabel lblId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblId_Create($strControlId = null) {
			$this->lblId = new QLabel($this->objParentObject, $strControlId);
			$this->lblId->Name = QApplication::Translate('Id');
			if ($this->blnEditMode)
				$this->lblId->Text = $this->objTableProjectWon->Id;
			else
				$this->lblId->Text = 'N/A';
			return $this->lblId;
		}

		/**
		 * Create and setup QListBox lstProject
		 * @param string $strControlId optional ControlId to use
		 * @return QListBox
		 */
		public function lstProject_Create($strControlId = null) {
			$this->lstProject = new QListBox($this->objParentObject, $strControlId);
			$this->lstProject->Name = QApplication::Translate('Project');
			$this->lstProject->Required = true;
			if (!$this->blnEditMode)
				$this->lstProject->AddItem(QApplication::Translate('- Select One -'), null);
			$objProjectArray = TableProject::LoadAll();
			if ($objProjectArray) foreach ($objProjectArray as $objProject) {
				$objListItem = new QListItem($objProject->__toString(), $objProject->Id);
				if (($this->objTableProjectWon->Project) && ($this->objTableProjectWon->Project->Id == $objProject->Id))
					$objListItem->Selected = true;
				$this->lstProject->AddItem($objListItem);
			}
			return $this->lstProject;
		}

		/**
		 * Create and setup QLabel lblProjectId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblProjectId_Create($strControlId = null) {
			$this->lblProjectId = new QLabel($this->objParentObject, $strControlId);
			$this->lblProjectId->Name = QApplication::Translate('Project');
			$this->lblProjectId->Text = ($this->objTableProjectWon->Project) ? $this->objTableProjectWon->Project->__toString() : null;
			$this->lblProjectId->Required = true;
			return $this->lblProjectId;
		}

		/**
		 * Create and setup QListBox lstBuyer
		 * @param string $strControlId optional ControlId to use
		 * @return QListBox
		 */
		public function lstBuyer_Create($strControlId = null) {
			$this->lstBuyer = new QListBox($this->objParentObject, $strControlId);
			$this->lstBuyer->Name = QApplication::Translate('Buyer');
			$this->lstBuyer->Required = true;
			if (!$this->blnEditMode)
				$this->lstBuyer->AddItem(QApplication::Translate('- Select One -'), null);
			$objBuyerArray = TableUserProject::LoadAll();
			if ($objBuyerArray) foreach ($objBuyerArray as $objBuyer) {
				$objListItem = new QListItem($objBuyer->__toString(), $objBuyer->Id);
				if (($this->objTableProjectWon->Buyer) && ($this->objTableProjectWon->Buyer->Id == $objBuyer->Id))
					$objListItem->Selected = true;
				$this->lstBuyer->AddItem($objListItem);
			}
			return $this->lstBuyer;
		}

		/**
		 * Create and setup QLabel lblBuyerId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblBuyerId_Create($strControlId = null) {
			$this->lblBuyerId = new QLabel($this->objParentObject, $strControlId);
			$this->lblBuyerId->Name = QApplication::Translate('Buyer');
			$this->lblBuyerId->Text = ($this->objTableProjectWon->Buyer) ? $this->objTableProjectWon->Buyer->__toString() : null;
			$this->lblBuyerId->Required = true;
			return $this->lblBuyerId;
		}

		/**
		 * Create and setup QListBox lstProvider
		 * @param string $strControlId optional ControlId to use
		 * @return QListBox
		 */
		public function lstProvider_Create($strControlId = null) {
			$this->lstProvider = new QListBox($this->objParentObject, $strControlId);
			$this->lstProvider->Name = QApplication::Translate('Provider');
			$this->lstProvider->Required = true;
			if (!$this->blnEditMode)
				$this->lstProvider->AddItem(QApplication::Translate('- Select One -'), null);
			$objProviderArray = TableUserProject::LoadAll();
			if ($objProviderArray) foreach ($objProviderArray as $objProvider) {
				$objListItem = new QListItem($objProvider->__toString(), $objProvider->Id);
				if (($this->objTableProjectWon->Provider) && ($this->objTableProjectWon->Provider->Id == $objProvider->Id))
					$objListItem->Selected = true;
				$this->lstProvider->AddItem($objListItem);
			}
			return $this->lstProvider;
		}

		/**
		 * Create and setup QLabel lblProviderId
		 * @param string $strControlId optional ControlId to use
		 * @return QLabel
		 */
		public function lblProviderId_Create($strControlId = null) {
			$this->lblProviderId = new QLabel($this->objParentObject, $strControlId);
			$this->lblProviderId->Name = QApplication::Translate('Provider');
			$this->lblProviderId->Text = ($this->objTableProjectWon->Provider) ? $this->objTableProjectWon->Provider->__toString() : null;
			$this->lblProviderId->Required = true;
			return $this->lblProviderId;
		}

		/**
		 * Create and setup QIntegerTextBox txtBid
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtBid_Create($strControlId = null) {
			$this->txtBid = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtBid->Name = QApplication::Translate('Bid');
			$this->txtBid->Text = $this->objTableProjectWon->Bid;
			$this->txtBid->Required = true;
			return $this->txtBid;
		}

		/**
		 * Create and setup QLabel lblBid
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblBid_Create($strControlId = null, $strFormat = null) {
			$this->lblBid = new QLabel($this->objParentObject, $strControlId);
			$this->lblBid->Name = QApplication::Translate('Bid');
			$this->lblBid->Text = $this->objTableProjectWon->Bid;
			$this->lblBid->Required = true;
			$this->lblBid->Format = $strFormat;
			return $this->lblBid;
		}

		/**
		 * Create and setup QIntegerTextBox txtDay
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtDay_Create($strControlId = null) {
			$this->txtDay = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtDay->Name = QApplication::Translate('Day');
			$this->txtDay->Text = $this->objTableProjectWon->Day;
			$this->txtDay->Required = true;
			return $this->txtDay;
		}

		/**
		 * Create and setup QLabel lblDay
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblDay_Create($strControlId = null, $strFormat = null) {
			$this->lblDay = new QLabel($this->objParentObject, $strControlId);
			$this->lblDay->Name = QApplication::Translate('Day');
			$this->lblDay->Text = $this->objTableProjectWon->Day;
			$this->lblDay->Required = true;
			$this->lblDay->Format = $strFormat;
			return $this->lblDay;
		}

		/**
		 * Create and setup QDateTimePicker calWonDate
		 * @param string $strControlId optional ControlId to use
		 * @return QDateTimePicker
		 */
		public function calWonDate_Create($strControlId = null) {
			$this->calWonDate = new QDateTimePicker($this->objParentObject, $strControlId);
			$this->calWonDate->Name = QApplication::Translate('Won Date');
			$this->calWonDate->DateTime = $this->objTableProjectWon->WonDate;
			$this->calWonDate->DateTimePickerType = QDateTimePickerType::DateTime;
			return $this->calWonDate;
		}

		/**
		 * Create and setup QLabel lblWonDate
		 * @param string $strControlId optional ControlId to use
		 * @param string $strDateTimeFormat optional DateTimeFormat to use
		 * @return QLabel
		 */
		public function lblWonDate_Create($strControlId = null, $strDateTimeFormat = null) {
			$this->lblWonDate = new QLabel($this->objParentObject, $strControlId);
			$this->lblWonDate->Name = QApplication::Translate('Won Date');
			$this->strWonDateDateTimeFormat = $strDateTimeFormat;
			$this->lblWonDate->Text = sprintf($this->objTableProjectWon->WonDate) ? $this->objTableProjectWon->WonDate->__toString($this->strWonDateDateTimeFormat) : null;
			return $this->lblWonDate;
		}

		protected $strWonDateDateTimeFormat;


		/**
		 * Create and setup QDateTimePicker calRetractDate
		 * @param string $strControlId optional ControlId to use
		 * @return QDateTimePicker
		 */
		public function calRetractDate_Create($strControlId = null) {
			$this->calRetractDate = new QDateTimePicker($this->objParentObject, $strControlId);
			$this->calRetractDate->Name = QApplication::Translate('Retract Date');
			$this->calRetractDate->DateTime = $this->objTableProjectWon->RetractDate;
			$this->calRetractDate->DateTimePickerType = QDateTimePickerType::DateTime;
			return $this->calRetractDate;
		}

		/**
		 * Create and setup QLabel lblRetractDate
		 * @param string $strControlId optional ControlId to use
		 * @param string $strDateTimeFormat optional DateTimeFormat to use
		 * @return QLabel
		 */
		public function lblRetractDate_Create($strControlId = null, $strDateTimeFormat = null) {
			$this->lblRetractDate = new QLabel($this->objParentObject, $strControlId);
			$this->lblRetractDate->Name = QApplication::Translate('Retract Date');
			$this->strRetractDateDateTimeFormat = $strDateTimeFormat;
			$this->lblRetractDate->Text = sprintf($this->objTableProjectWon->RetractDate) ? $this->objTableProjectWon->RetractDate->__toString($this->strRetractDateDateTimeFormat) : null;
			return $this->lblRetractDate;
		}

		protected $strRetractDateDateTimeFormat;


		/**
		 * Create and setup QDateTimePicker calAcceptDate
		 * @param string $strControlId optional ControlId to use
		 * @return QDateTimePicker
		 */
		public function calAcceptDate_Create($strControlId = null) {
			$this->calAcceptDate = new QDateTimePicker($this->objParentObject, $strControlId);
			$this->calAcceptDate->Name = QApplication::Translate('Accept Date');
			$this->calAcceptDate->DateTime = $this->objTableProjectWon->AcceptDate;
			$this->calAcceptDate->DateTimePickerType = QDateTimePickerType::DateTime;
			return $this->calAcceptDate;
		}

		/**
		 * Create and setup QLabel lblAcceptDate
		 * @param string $strControlId optional ControlId to use
		 * @param string $strDateTimeFormat optional DateTimeFormat to use
		 * @return QLabel
		 */
		public function lblAcceptDate_Create($strControlId = null, $strDateTimeFormat = null) {
			$this->lblAcceptDate = new QLabel($this->objParentObject, $strControlId);
			$this->lblAcceptDate->Name = QApplication::Translate('Accept Date');
			$this->strAcceptDateDateTimeFormat = $strDateTimeFormat;
			$this->lblAcceptDate->Text = sprintf($this->objTableProjectWon->AcceptDate) ? $this->objTableProjectWon->AcceptDate->__toString($this->strAcceptDateDateTimeFormat) : null;
			return $this->lblAcceptDate;
		}

		protected $strAcceptDateDateTimeFormat;


		/**
		 * Create and setup QIntegerTextBox txtStatus
		 * @param string $strControlId optional ControlId to use
		 * @return QIntegerTextBox
		 */
		public function txtStatus_Create($strControlId = null) {
			$this->txtStatus = new QIntegerTextBox($this->objParentObject, $strControlId);
			$this->txtStatus->Name = QApplication::Translate('Status');
			$this->txtStatus->Text = $this->objTableProjectWon->Status;
			$this->txtStatus->Required = true;
			return $this->txtStatus;
		}

		/**
		 * Create and setup QLabel lblStatus
		 * @param string $strControlId optional ControlId to use
		 * @param string $strFormat optional sprintf format to use
		 * @return QLabel
		 */
		public function lblStatus_Create($strControlId = null, $strFormat = null) {
			$this->lblStatus = new QLabel($this->objParentObject, $strControlId);
			$this->lblStatus->Name = QApplication::Translate('Status');
			$this->lblStatus->Text = $this->objTableProjectWon->Status;
			$this->lblStatus->Required = true;
			$this->lblStatus->Format = $strFormat;
			return $this->lblStatus;
		}



		/**
		 * Refresh this MetaControl with Data from the local TableProjectWon object.
		 * @param boolean $blnReload reload TableProjectWon from the database
		 * @return void
		 */
		public function Refresh($blnReload = false) {
			if ($blnReload)
				$this->objTableProjectWon->Reload();

			if ($this->lblId) if ($this->blnEditMode) $this->lblId->Text = $this->objTableProjectWon->Id;

			if ($this->lstProject) {
					$this->lstProject->RemoveAllItems();
				if (!$this->blnEditMode)
					$this->lstProject->AddItem(QApplication::Translate('- Select One -'), null);
				$objProjectArray = TableProject::LoadAll();
				if ($objProjectArray) foreach ($objProjectArray as $objProject) {
					$objListItem = new QListItem($objProject->__toString(), $objProject->Id);
					if (($this->objTableProjectWon->Project) && ($this->objTableProjectWon->Project->Id == $objProject->Id))
						$objListItem->Selected = true;
					$this->lstProject->AddItem($objListItem);
				}
			}
			if ($this->lblProjectId) $this->lblProjectId->Text = ($this->objTableProjectWon->Project) ? $this->objTableProjectWon->Project->__toString() : null;

			if ($this->lstBuyer) {
					$this->lstBuyer->RemoveAllItems();
				if (!$this->blnEditMode)
					$this->lstBuyer->AddItem(QApplication::Translate('- Select One -'), null);
				$objBuyerArray = TableUserProject::LoadAll();
				if ($objBuyerArray) foreach ($objBuyerArray as $objBuyer) {
					$objListItem = new QListItem($objBuyer->__toString(), $objBuyer->Id);
					if (($this->objTableProjectWon->Buyer) && ($this->objTableProjectWon->Buyer->Id == $objBuyer->Id))
						$objListItem->Selected = true;
					$this->lstBuyer->AddItem($objListItem);
				}
			}
			if ($this->lblBuyerId) $this->lblBuyerId->Text = ($this->objTableProjectWon->Buyer) ? $this->objTableProjectWon->Buyer->__toString() : null;

			if ($this->lstProvider) {
					$this->lstProvider->RemoveAllItems();
				if (!$this->blnEditMode)
					$this->lstProvider->AddItem(QApplication::Translate('- Select One -'), null);
				$objProviderArray = TableUserProject::LoadAll();
				if ($objProviderArray) foreach ($objProviderArray as $objProvider) {
					$objListItem = new QListItem($objProvider->__toString(), $objProvider->Id);
					if (($this->objTableProjectWon->Provider) && ($this->objTableProjectWon->Provider->Id == $objProvider->Id))
						$objListItem->Selected = true;
					$this->lstProvider->AddItem($objListItem);
				}
			}
			if ($this->lblProviderId) $this->lblProviderId->Text = ($this->objTableProjectWon->Provider) ? $this->objTableProjectWon->Provider->__toString() : null;

			if ($this->txtBid) $this->txtBid->Text = $this->objTableProjectWon->Bid;
			if ($this->lblBid) $this->lblBid->Text = $this->objTableProjectWon->Bid;

			if ($this->txtDay) $this->txtDay->Text = $this->objTableProjectWon->Day;
			if ($this->lblDay) $this->lblDay->Text = $this->objTableProjectWon->Day;

			if ($this->calWonDate) $this->calWonDate->DateTime = $this->objTableProjectWon->WonDate;
			if ($this->lblWonDate) $this->lblWonDate->Text = sprintf($this->objTableProjectWon->WonDate) ? $this->objTableProjectWon->WonDate->__toString($this->strWonDateDateTimeFormat) : null;

			if ($this->calRetractDate) $this->calRetractDate->DateTime = $this->objTableProjectWon->RetractDate;
			if ($this->lblRetractDate) $this->lblRetractDate->Text = sprintf($this->objTableProjectWon->RetractDate) ? $this->objTableProjectWon->RetractDate->__toString($this->strRetractDateDateTimeFormat) : null;

			if ($this->calAcceptDate) $this->calAcceptDate->DateTime = $this->objTableProjectWon->AcceptDate;
			if ($this->lblAcceptDate) $this->lblAcceptDate->Text = sprintf($this->objTableProjectWon->AcceptDate) ? $this->objTableProjectWon->AcceptDate->__toString($this->strAcceptDateDateTimeFormat) : null;

			if ($this->txtStatus) $this->txtStatus->Text = $this->objTableProjectWon->Status;
			if ($this->lblStatus) $this->lblStatus->Text = $this->objTableProjectWon->Status;

		}



		///////////////////////////////////////////////
		// PROTECTED UPDATE METHODS for ManyToManyReferences (if any)
		///////////////////////////////////////////////





		///////////////////////////////////////////////
		// PUBLIC TABLEPROJECTWON OBJECT MANIPULATORS
		///////////////////////////////////////////////

		/**
		 * This will save this object's TableProjectWon instance,
		 * updating only the fields which have had a control created for it.
		 */
		public function SaveTableProjectWon() {
			try {
				// Update any fields for controls that have been created
				if ($this->lstProject) $this->objTableProjectWon->ProjectId = $this->lstProject->SelectedValue;
				if ($this->lstBuyer) $this->objTableProjectWon->BuyerId = $this->lstBuyer->SelectedValue;
				if ($this->lstProvider) $this->objTableProjectWon->ProviderId = $this->lstProvider->SelectedValue;
				if ($this->txtBid) $this->objTableProjectWon->Bid = $this->txtBid->Text;
				if ($this->txtDay) $this->objTableProjectWon->Day = $this->txtDay->Text;
				if ($this->calWonDate) $this->objTableProjectWon->WonDate = $this->calWonDate->DateTime;
				if ($this->calRetractDate) $this->objTableProjectWon->RetractDate = $this->calRetractDate->DateTime;
				if ($this->calAcceptDate) $this->objTableProjectWon->AcceptDate = $this->calAcceptDate->DateTime;
				if ($this->txtStatus) $this->objTableProjectWon->Status = $this->txtStatus->Text;

				// Update any UniqueReverseReferences (if any) for controls that have been created for it

				// Save the TableProjectWon object
				$this->objTableProjectWon->Save();

				// Finally, update any ManyToManyReferences (if any)
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}

		/**
		 * This will DELETE this object's TableProjectWon instance from the database.
		 * It will also unassociate itself from any ManyToManyReferences.
		 */
		public function DeleteTableProjectWon() {
			$this->objTableProjectWon->Delete();
		}		



		///////////////////////////////////////////////
		// PUBLIC GETTERS and SETTERS
		///////////////////////////////////////////////

		/**
		 * Override method to perform a property "Get"
		 * This will get the value of $strName
		 *
		 * @param string $strName Name of the property to get
		 * @return mixed
		 */
		public function __get($strName) {
			switch ($strName) {
				// General MetaControlVariables
				case 'TableProjectWon': return $this->objTableProjectWon;
				case 'TitleVerb': return $this->strTitleVerb;
				case 'EditMode': return $this->blnEditMode;

				// Controls that point to TableProjectWon fields -- will be created dynamically if not yet created
				case 'IdControl':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'IdLabel':
					if (!$this->lblId) return $this->lblId_Create();
					return $this->lblId;
				case 'ProjectIdControl':
					if (!$this->lstProject) return $this->lstProject_Create();
					return $this->lstProject;
				case 'ProjectIdLabel':
					if (!$this->lblProjectId) return $this->lblProjectId_Create();
					return $this->lblProjectId;
				case 'BuyerIdControl':
					if (!$this->lstBuyer) return $this->lstBuyer_Create();
					return $this->lstBuyer;
				case 'BuyerIdLabel':
					if (!$this->lblBuyerId) return $this->lblBuyerId_Create();
					return $this->lblBuyerId;
				case 'ProviderIdControl':
					if (!$this->lstProvider) return $this->lstProvider_Create();
					return $this->lstProvider;
				case 'ProviderIdLabel':
					if (!$this->lblProviderId) return $this->lblProviderId_Create();
					return $this->lblProviderId;
				case 'BidControl':
					if (!$this->txtBid) return $this->txtBid_Create();
					return $this->txtBid;
				case 'BidLabel':
					if (!$this->lblBid) return $this->lblBid_Create();
					return $this->lblBid;
				case 'DayControl':
					if (!$this->txtDay) return $this->txtDay_Create();
					return $this->txtDay;
				case 'DayLabel':
					if (!$this->lblDay) return $this->lblDay_Create();
					return $this->lblDay;
				case 'WonDateControl':
					if (!$this->calWonDate) return $this->calWonDate_Create();
					return $this->calWonDate;
				case 'WonDateLabel':
					if (!$this->lblWonDate) return $this->lblWonDate_Create();
					return $this->lblWonDate;
				case 'RetractDateControl':
					if (!$this->calRetractDate) return $this->calRetractDate_Create();
					return $this->calRetractDate;
				case 'RetractDateLabel':
					if (!$this->lblRetractDate) return $this->lblRetractDate_Create();
					return $this->lblRetractDate;
				case 'AcceptDateControl':
					if (!$this->calAcceptDate) return $this->calAcceptDate_Create();
					return $this->calAcceptDate;
				case 'AcceptDateLabel':
					if (!$this->lblAcceptDate) return $this->lblAcceptDate_Create();
					return $this->lblAcceptDate;
				case 'StatusControl':
					if (!$this->txtStatus) return $this->txtStatus_Create();
					return $this->txtStatus;
				case 'StatusLabel':
					if (!$this->lblStatus) return $this->lblStatus_Create();
					return $this->lblStatus;
				default:
					try {
						return parent::__get($strName);
					} catch (QCallerException $objExc) {
						$objExc->IncrementOffset();
						throw $objExc;
					}
			}
		}

		/**
		 * Override method to perform a property "Set"
		 * This will set the property $strName to be $mixValue
		 *
		 * @param string $strName Name of the property to set
		 * @param string $mixValue New value of the property
		 * @return mixed
		 */
		public function __set($strName, $mixValue) {
			try {
				switch ($strName) {
					// Controls that point to TableProjectWon fields
					case 'IdControl':
						return ($this->lblId = QType::Cast($mixValue, 'QControl'));
					case 'ProjectIdControl':
						return ($this->lstProject = QType::Cast($mixValue, 'QControl'));
					case 'BuyerIdControl':
						return ($this->lstBuyer = QType::Cast($mixValue, 'QControl'));
					case 'ProviderIdControl':
						return ($this->lstProvider = QType::Cast($mixValue, 'QControl'));
					case 'BidControl':
						return ($this->txtBid = QType::Cast($mixValue, 'QControl'));
					case 'DayControl':
						return ($this->txtDay = QType::Cast($mixValue, 'QControl'));
					case 'WonDateControl':
						return ($this->calWonDate = QType::Cast($mixValue, 'QControl'));
					case 'RetractDateControl':
						return ($this->calRetractDate = QType::Cast($mixValue, 'QControl'));
					case 'AcceptDateControl':
						return ($this->calAcceptDate = QType::Cast($mixValue, 'QControl'));
					case 'StatusControl':
						return ($this->txtStatus = QType::Cast($mixValue, 'QControl'));
					default:
						return parent::__set($strName, $mixValue);
				}
			} catch (QCallerException $objExc) {
				$objExc->IncrementOffset();
				throw $objExc;
			}
		}
	}
?>